import { IsNotEmpty, IsString, Matches, MaxLength, MinLength } from 'class-validator'

export class LoginDTO {
    @MaxLength(18, { message: '账号须是6-18位长度' })
    @MinLength(6, { message: '账号须是6-18位长度' })
    @Matches(/^[A-Za-z]{1}/, { message: '账号必须由字母开头' })
    @IsNotEmpty({ message: '账号不能为空' })
    username!: string

    @IsString({ message: '密码格式有误' })
    @MaxLength(16, { message: '密码最大长度为16' })
    @MinLength(8, { message: '密码最小长度为8' })
    @IsNotEmpty({ message: '密码不能为空' })
    password!: string
}
